package day2;

import java.io.File;



public
class TestDelete {
    public static
    void main(String[] args) {
        File f = new File("d://a");
        deleteFile(f);
    }

    private static
    void deleteFile(File f) {
        //fs==null 是文件  fs长度=0 是目录-->delete()
        //fs有长度 需要递归删除

        File[] fs = f.listFiles();
        if (fs != null ) {
                for (File file : fs) {
                    deleteFile(file);
                }
            }
        if (f.delete()) {
            System.out.println(f.getAbsolutePath() + "删除成功");
        }
    }
}

